using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using XvueFx.API;
namespace ApplicationUseOverride
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        XvueFx.API.XvueFxSystem system = new XvueFxSystem();

        //the most common issue here is that the xvue.licensing.dll needs to be manually copy
        //to the current output directory of this project
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                //open XvueFxSystem primary showing any error messages
                system.Open(0, true);
                //load a configuration
                system.LoadConfiguration("Playout");//ChangeThisToYourConfigurationName");
                //get live windows back

                system.ShowAndDockUIForOutputChannel(XVUEfxSDK.EnumOutputChannels.ChannelOutput1,
                    EnumUIOutput.OutputLiveWindow, panelVideo);
                system.ShowAndDockUIForOutputChannel(XVUEfxSDK.EnumOutputChannels.ChannelOutput1,
                    EnumUIOutput.OutputVUWindow, panelVU);

                //set samples IXvueSequencerUser interface
                //from now on samples work without knowing if its local iorasis-plugin
                //remoting or override iOrasis application
                mainUserControlSamples1.SetSequencer(system.GetSequencerForOutputChannel
                                            (XVUEfxSDK.EnumOutputChannels.ChannelOutput1));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                //close system while closing application
                system.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message );
            }
        }
    }
}